/**
 * 学习目标：课堂练习
 */
import React from 'react';
import ReactDOM from 'react-dom';

class App extends React.Component {
  state = {
    count: 0,
  };

  render() {
    return (
      <div>
        <p>当前数值为：{this.state.count}</p>
        <hr />
        <button onClick={() => this.Click(1)}>+1</button>
        <span>{this.state.count}</span>
        <button onClick={() => this.Click(-1)}>-1</button>
      </div>
    );
  }
  Click = (num) => {
    this.setState({ count: this.state.count + num });
  };
  // Clickk = () => {
  //   this.setState({ count: this.state.count - 1 });
  // };
}

ReactDOM.render(<App></App>, document.getElementById('root'));
